﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class FrameEditorRect
{
    public Vector2 LeftTop;
    public Vector2 RightBottom;
    public FrameEditorRect()
    { }
    public FrameEditorRect(Vector2 leftTop, Vector2 rightBottom)
    {
        LeftTop = leftTop;
        RightBottom = rightBottom;
    }
}
public class FrameDrawGizmos : MonoBehaviour
{

   public  List<FrameEditorRect> rectList = new List<FrameEditorRect>();
         
    void OnDrawGizmos()
    {
        Debug.Log("drawGizmos");
        Gizmos.color = Color.yellow;

        for (int i = 0; i < rectList.Count; i++)
        {
            Vector3 LeftTop = rectList[i].LeftTop;
            Vector3 RightBottom = rectList[i].RightBottom;
            Vector3 LeftBottom = new Vector3(LeftTop.x, RightBottom.y);
            Vector3 RightTop = new Vector3(RightBottom.x, LeftTop.y);
            if (Vector3.Distance(LeftTop, RightBottom) > 0)
            {
                Gizmos.DrawLine(LeftTop, RightTop);
                Gizmos.DrawLine(RightTop, RightBottom);
                Gizmos.DrawLine(RightBottom, LeftBottom);
                Gizmos.DrawLine(LeftBottom, LeftTop);

            }

        }
    }

    public void SetRcetList(List<FrameEditorRect> list)
    {
        rectList.Clear();
        for (int i = 0; i < list.Count; i++)
        {
            rectList.Add(list[i]);
        }
    }

  
}
